#!/bin/bash
echo 'set -x HOMEBREW_BOTTLE_DOMAIN https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' | tee ~/.config/fish/conf.d/homebrew.fish

echo 'set -x PATH "/usr/local/opt/coreutils/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/coreutils/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x PATH "/usr/local/opt/findutils/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/findutils/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x PATH "/usr/local/opt/gnu-tar/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/gnu-tar/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x PATH "/usr/local/opt/gnu-sed/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/gnu-sed/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x PATH "/usr/local/opt/grep/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/grep/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x PATH "/usr/local/opt/gawk/libexec/gnubin" $PATH' | tee -a ~/.config/fish/conf.d/homebrew.fish
echo 'set -x MANPATH "/usr/local/opt/gawk/libexec/gnuman" $MANPATH' | tee -a ~/.config/fish/conf.d/homebrew.fish

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

## Recover
# git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
# git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core


brew tap homebrew/bundle
brew tap homebrew/cask
brew tap homebrew/cask-drivers
brew tap homebrew/cask-fonts
brew tap homebrew/command-not-found
brew tap homebrew/core

brew update
